﻿<?=$this->load->view('include_header',null)?>
    <div id="top-panel">
        <div id="panel">
            <ul>
                <li class="current"><a href="<?=site_url('archive/idcard/'.$id)?>" class="report"><?=(empty($id))?"录入新":"编辑"?>客户基本信息</a></li>
                
            </ul>
        </div>
    </div>
    <div id="wrapper">
        <div id="content">
            <div id="box">
            <form id="form" method="POST" action="<?=site_url('archive/parents_update/'.$cateid)?>">
            <div>
            <fieldset>
            <legend>未成年人出行-父母授权书<br>Parental Authorization for Minors</legend>
            <label>父亲姓名<br>Father’s Full Name</label><input type="text" name="father_name" value="<?=@$info->father_name?>" /> <br />   <br />
            <label>父亲出生日期<br>Father’s Date of Birth</label><input type="text" id="father_birth" name="father_birth" value="<?=@$info->father_birth?>" /> <br /><br />
            <label>父亲身份证号码<br>Father’s National ID No.</label><input type="text" name="father_idcard" value="<?=@$info->father_idcard?>" style="width:300px"/> <br /><br />
            <label>母亲姓名<br>Mother’s Full Name</label><input type="text" name="mother_name" value="<?=@$info->mother_name?>" /> <br /> <br />
            <label>母亲出生日期<br>Mother’s Date of Birth</label><input type="text" id="mother_birth" name="mother_birth" value="<?=@$info->mother_birth?>" /> <br /> <br />
            <label>母亲身份证号码<br>Mother’s National ID No.</label><input type="text" name="mother_idcard" value="<?=@$info->mother_idcard?>" style="width:300px"/> <br /> <br />
            <label>监护人姓名(如适用)<br>Legal Guardian’s Full Name (If Applicable)</label><input type="text" name="guardian_name" value="<?=@$info->guardian_name?>" /> <br /> <br />
            <label>监护人出生日期(如适用)<br>Legal Guardian’s Date Of Birth</label><input type="text" id="guardian_birth" name="guardian_birth" value="<?=@$info->guardian_birth?>" /> <br /> <br />
            <label>监护人身份证号码(如适用)<br>Legal Guardian’s National ID No.</label><input type="text" name="guardian_idcard" value="<?=@$info->guardian_idcard?>" /> <br /><br />
            <label>未成年人姓名<br>Minor’s Full Name</label><input type="text" name="full_name" value="<?=@$info->full_name?>" /> <br /><br />
            <label>未成年人出生日期<br>Minor’s Date of Birth</label><input type="text" id="birth" name="birth" value="<?=@$info->birth?>" /> <br /> <br />
            <label>未成年人身份证号码<br>Minor’s National ID No.</label><input type="text" name="idcard" value="<?=@$info->idcard?>" /> <br /><br />
            <label>谁带该未成人出行<br>Who will stay with the Minor when abroad</label><input type="text" name="accompany" value="<?=@$info->accompany?>"/> <br /><br />
            <label>未成年人出行目的地<br>Minor’s destination</label><input type="text" id="destination" name="destination" value="<?=@$info->destination?>" style="background:#FFFFC0; width:200px" /> <br /><br />
            <label>未成年人何时出发<br>When will the minor visting abroad</label><input type="text" id="start_date" name="start_date" value="<?=@$info->start_date?>" /> <br /> <br />
            <label>未成人年何时返回<br>When will the Minor Come back</label><input type="text" id="back_date" name="back_date" value="<?=@$info->back_date?>"/>  <br /><br />
            <label>父母同意信签发日期<br>Date of issue this Letter</label><input type="text" id="sign_date" name="sign_date" value="<?=@$info->sign_date?>"/> <br /> <br />
            <label>父母同意信签发地点<br>Place of issue thisLetter</label><input type="text" id="sign_address" name="sign_address" value="<?=@$info->sign_address?>" style="background:#FFFFC0; width:200px"/> <br /><br />
            </fieldset>
            </div> 
            <div style="clear: both;">            
            <input type="hidden" name="id" value="<?=$id?>" />
            <input id="button1" type="submit" value="提交信息 Continue" onclick="return check_date_rules()"/>
            <input id="button2" type="reset" value="重置 Cancel" />
            </div>
            </form>
            </div>
        </div>
        
        <script type="text/javascript" src="js/jquery.autocomplete.pack.js"></script>
        <link type="text/css" rel="stylesheet" href="css/jquery.autocomplete.css"/>
        
        <?=$this->load->view('include_sidebar',array('id'=>$id,'forms'=>$forms))?>
    </div>

    <script type="text/javascript">
    function check_date_rules() {
        if(convert_to_date($('#sign_date').val()).getTime() >  new Date().getTime()) {
            alert('[签发日期]不能大于[当前日期]！');
            return false;
        }   
        if(convert_to_date($('#father_birth').val()).getTime() > new Date().getTime() ||
			convert_to_date($('#mother_birth').val()).getTime() > new Date().getTime() ||
			convert_to_date($('#guardian_birth').val()).getTime() > new Date().getTime() ||
			convert_to_date($('#birth').val()).getTime() > new Date().getTime()) {
            $('#birth1').focus();
            alert('[出生日期]均不能大于[当前日期]！'); 
            return false;
        }                  
        return true; 
    }
    
    $().ready(function() {
      $("#form").validate({
        rules: {
            full_name:{
             required:true
            },
            employer_name:{
             required:true
            },
            employer_address:{
             required:true
            },
            income:{
             required:true
            }
        }
      });

    $.datepicker.setDefaults(
            {
            dateFormat: 'dd/mm/yy',
            readOnly: false,
            changeMonth: true,
            changeYear: true,
            showOn: "both",
            buttonImage: "images/calendar.gif",
            buttonImageOnly: true
            }
        );
          
        $( "#father_birth" ).datepicker();
        $( "#mother_birth" ).datepicker(); 
        $( "#guardian_birth" ).datepicker(); 
        $( "#birth" ).datepicker(); 
        $( "#start_date" ).datepicker(); 
        $( "#back_date" ).datepicker(); 
        $( "#sign_date" ).datepicker()
       
        
        $("#destination").autocomplete("<?=base_url()?>user/quick_search_country", {
            minChars: 0,
            width: 500,
            matchContains: "word",
            autoFill: false,
            formatItem: function(row, i, max) {
                var arr = (row+"").split(",");
                return i + "/" + max + ": " + arr[1] + '['+ arr[2] +']' + '['+ arr[4] +']';
            },
            formatMatch: function(row, i, max) {
                return row;
            },
            formatResult: function(row) {
                var arr = (row+"").split(",");
                return arr[4];
            }
        });
        
        $("#sign_address").autocomplete("<?=base_url()?>user/quick_search_province", {
            minChars: 0,
            width: 500,
            matchContains: "word",
            autoFill: false,
            formatItem: function(row, i, max) {
                var arr = (row+"").split(",");
                return i + "/" + max + ": " + arr[1] + '['+ arr[2] +']';
            },
            formatMatch: function(row, i, max) {
                return row;
            },
            formatResult: function(row) {
                var arr = (row+"").split(",");
                return arr[2];
            }
        });  
      
    });
    </script>
    
<?=$this->load->view('include_footer',null)?>
